<template>
  <admin-layout class="ArticleShow">
    <h1>ArticleCreate</h1>
    <el-form ref="form" :model="form" label-width="120px" >
      <el-form-item label="name">
        <el-input v-model="form.name"></el-input>
      </el-form-item>

      <el-form-item label="phone">
        <el-input v-model="form.phone"></el-input>
      </el-form-item>
      <el-form-item label="address">
        <el-input v-model="form.address"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit()">提交</el-button>
      </el-form-item>
    </el-form>
  </admin-layout>
</template>

<script>


import axios from 'axios'
export default {
  name: "ArticleCreate",
  data() {
    return {
      form: {
        name: "",
        phone:"",
        address:"",
      },
    }
  },
  methods: {
    onSubmit() {
        const that = this
        axios({
          method:'post',
          url:'http://jd.kelinmen.com/index/index/addUser',
          datatype:'json',
          headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
          },
          data: JSON.stringify({
            name:that.form.name,
            phone:that.form.phone,
            address:that.form.address
          }),
        }).then(function (res) {
          console.log(res)
          that.$router.push("/home")
        })
      }
  },
};
</script>

<style>


</style>
